Skip to content

Conversation

@chrisrink10
Copy link
Member

Fixes #1078
Fixes #1090

Comment on lines -5815 to -5817
or-binding (get ors sym)]
(if or-binding
[sym `(or (get ~fn-arg ~kw) ~or-binding)]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was another latent bug (for all 4 groups below) where we would not provide the default if it was falsey. For nil that likely doesn't matter because nil is already the default for get, but for false this would make it impossible to override with false.

Comment on lines +5844 to +5849
[fn-arg
`(if (seq? ~fn-arg)
(if (next ~fn-arg)
(apply hash-map ~fn-arg)
(first ~fn-arg))
~fn-arg)]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clojure apparently takes sequences and coerces them to maps for map destructuring or, if the sequence is only a single element, takes the first arg as if it were a map.

@chrisrink10 chrisrink10 marked this pull request as ready for review October 18, 2024 18:49
@chrisrink10 chrisrink10 merged commit 91fd511 into main Oct 18, 2024
12 checks passed
@chrisrink10 chrisrink10 deleted the fix/destructuring-errors branch October 18, 2024 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

grafeceful handling of vector destructuring to map keys default vaue in map destructuring can override falsy key values

1 participant